package com.huawei.appgallery.assistantdock.buoydock.card.node;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import com.huawei.appgallery.assistantdock.base.cardkit.card.BuoyBaseCard;
import com.huawei.appgallery.assistantdock.base.cardkit.node.BuoyBaseNode;
import com.huawei.appgallery.assistantdock.buoydock.card.bean.BuoyForumNoticeCardBeanBuoy;
import com.huawei.appgallery.assistantdock.buoydock.card.bean.BuoyForumNoticeItem;
import com.huawei.appgallery.assistantdock.buoydock.card.card.BuoyForumNoticeCardBuoy;
import com.huawei.appgallery.assistantdock.buoydock.card.card.BuoyForumNoticeItemCardBuoy;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import java.util.ArrayList;
import java.util.List;
import o.beo$e;
import o.beo$j;
import o.cgz;
import o.chy;
import o.chz;
import o.cih;
import o.CollectCheck;

public class BuoyForumNoticeNodeBuoy extends BuoyBaseNode {
    private BuoyForumNoticeCardBeanBuoy ʻ = null;
    private BuoyForumNoticeCardBuoy ˊ = null;

    public BuoyForumNoticeNodeBuoy(Context context) {
        super(context);
    }

    public boolean ˊ(ViewGroup viewGroup, ViewGroup viewGroup2) {
        LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
        layoutParams.weight = 1.0f;
        LayoutInflater from = LayoutInflater.from(this.ॱ);
        this.ˊ = new BuoyForumNoticeCardBuoy(this.ॱ);
        View inflate = from.inflate(beo$j.ᐝ, null);
        this.ˊ.ॱ(inflate);
        ˊ(this.ˊ);
        viewGroup.addView(inflate, layoutParams);
        return true;
    }

    public boolean ॱ(chz o_chz, ViewGroup viewGroup) {
        int ˏ = ˏ();
        this.ˏ = o_chz.ˏ;
        for (int i = 0; i < ˏ; i++) {
            cih ˎ = ˎ(i);
            if (ˎ instanceof BuoyForumNoticeCardBuoy) {
                BuoyForumNoticeCardBuoy buoyForumNoticeCardBuoy = (BuoyForumNoticeCardBuoy) ˎ;
                CardBean ˋ = o_chz.ˋ(i);
                if (ˋ instanceof BuoyForumNoticeCardBeanBuoy) {
                    ˋ.ˋˋ(String.valueOf(this.ˏ));
                    this.ʻ = (BuoyForumNoticeCardBeanBuoy) ˋ;
                    List ˊ = this.ʻ.ˊ();
                    if (CollectCheck.isEmpty(ˊ)) {
                        ˎ.ˉ().setVisibility(8);
                    } else {
                        ˎ(buoyForumNoticeCardBuoy, ˊ.size(), 1);
                        buoyForumNoticeCardBuoy.ˋ("BuoyForumNoticeNodeBuoy");
                        buoyForumNoticeCardBuoy.ˏ(ˋ);
                        ˎ.ˉ().setVisibility(0);
                    }
                } else {
                    ˎ.ˉ().setVisibility(8);
                }
            }
        }
        return true;
    }

    private void ˎ(BuoyForumNoticeCardBuoy buoyForumNoticeCardBuoy, int i, int i2) {
        buoyForumNoticeCardBuoy.ˊ();
        View findViewById = buoyForumNoticeCardBuoy.ˉ().findViewById(beo$e.ʻˋ);
        if (findViewById instanceof ViewGroup) {
            ((ViewGroup) findViewById).removeAllViews();
        }
        LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
        layoutParams.weight = 1.0f;
        LayoutInflater from = LayoutInflater.from(this.ॱ);
        for (int i3 = 0; i3 < i; i3++) {
            View view = (ViewGroup) from.inflate(beo$j.ʼ, null);
            if (view != null) {
                BuoyBaseCard buoyForumNoticeItemCardBuoy = new BuoyForumNoticeItemCardBuoy(this.ॱ);
                buoyForumNoticeItemCardBuoy.ˏ(view);
                buoyForumNoticeCardBuoy.ˊ(buoyForumNoticeItemCardBuoy);
                new LinearLayout.LayoutParams(-1, -1).weight = 1.0f;
                if (findViewById instanceof ViewGroup) {
                    ((ViewGroup) findViewById).addView(view, layoutParams);
                }
            }
        }
    }

    public void ˋ(chy o_chy) {
        cgz ˊ = ˊ(0);
        if (ˊ instanceof BuoyForumNoticeCardBuoy) {
            ((BuoyForumNoticeCardBuoy) ˊ).ॱ(o_chy);
        }
    }

    public boolean ॱ() {
        return true;
    }

    public ArrayList<String> z_() {
        if (this.ʻ == null) {
            return null;
        }
        ArrayList<String> arrayList = new ArrayList();
        List ˊ = this.ʻ.ˊ();
        if (ˊ == null) {
            return null;
        }
        for (int i = 0; i < ˊ.size(); i++) {
            BuoyForumNoticeItem buoyForumNoticeItem = (BuoyForumNoticeItem) ˊ.get(i);
            if (buoyForumNoticeItem != null) {
                arrayList.add(buoyForumNoticeItem.ॱॱ() + "#$#" + buoyForumNoticeItem.u_());
            }
        }
        return arrayList;
    }
}
